import App from './App'
// 引入Vuex
import store from '@/store';
// 引入全局样式
import "@/static/styles/index.scss";
// 通用列表项组件
import ListItem from "@/components/ListItem";
// 通用活动项组件
import ActivityItem from "@/components/ActivityItem";
// 通用工具函数
import {
	parseTime,
	handleToPage,
	handleCallPhone,
	handleNavigation,
	formatDistance
} from "@/utils";
// 引入全局配置
import config from "@/config";
// 引入z-pazing配置
import zConfig from "@/uni_modules/z-paging/components/z-paging/js/z-paging-config";
// 引入uvUI的工具函数
import uvUI from '@/uni_modules/uv-ui-tools'

// z-paging全局配置
zConfig.setConfig({
	//配置分页默认pageSize为15
	'default-page-size': config.defaultPageSize,
	//配置空数据图默认描述文字为：空空如也~~
	'empty-view-text': config.emptyViewText,
})

import {
	createSSRApp
} from 'vue'

export function createApp() {
	const app = createSSRApp(App)
	app.use(store)
	app.use(uvUI);
	// 注册全局组件
	app.component("ListItem", ListItem);
	app.component("ActivityItem", ActivityItem);
	// 注册全局方法
	app.config.globalProperties.parseTime = parseTime;
	app.config.globalProperties.handleToPage = handleToPage;
	app.config.globalProperties.handleCallPhone = handleCallPhone;
	app.config.globalProperties.handleNavigation = handleNavigation;
	app.config.globalProperties.formatDistance = formatDistance;
	return {
		app
	}
}